home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d11 / ev678dev.arc / EV678DEV.DOC < prev    next >
Text File  |  1990-07-03  |  31KB  |  910 lines

  1. ;------------------------------------------------------------------------
  2. ;This document contains a list of extended BIOS functions available on
  3. ;the Everex Viewpoint VGA.  This set of functions is slightly different
  4. ;from thoses available on the EVGA.  This new set of Everex Extended
  5. ;functions will become a standard fixture in future Everex EGA/VGA BIOS.
  6. ;In particular, the 'Get mode supported info for current' (BX=0005h) and
  7. ;'Get paging function pointer for current mode' (BX=0004h) will allow
  8. ;well written applications to work on all Everex cards, regardless of
  9. ;future hardware enhancements.
  10. ;------------------------------------------------------------------------
  11. ;Everex Extended Set Mode function:
  12. ;(This function applies across all Everex EGA and VGA graphics adapters.)
  13. ;    mov    ax,0070h        ;(b7 of AL still acts as save regen)
  14. ;    mov    bl,02h            ;Example Everex mode: 800x600 16 color
  15. ;    int    10h
  16. ;------------------------------------------------------------------------
  17. ;For all functions, AX = 7000h on entry, and AL = 70h on exit if function
  18. ;was successful.
  19. ;
  20. ;    bx = 00h: return emulation status
  21. ;    Exit:
  22. ;        - cl = monitor type
  23. ;            00 = mono
  24. ;            01 = cga
  25. ;            02 = ega
  26. ;            03 = dmf
  27. ;            04 = IBM PS/2
  28. ;            05 = IBM 8514
  29. ;            06 = amf
  30. ;            07 = amf
  31. ;        - ch (b0)   = 6845 emulation
  32. ;             (b1,3) = unused (0)
  33. ;             (b4)   = VGA Protect enabled
  34. ;             (b5)   = Special oscillator present (44.9MHz for Ev678)
  35. ;             (b6,7) = 256K/512K/1024K/2048K
  36. ;        - dx = BCD board id (b15..b4: model, b3..b0: revision)
  37. ;        - di = BCD BIOS version number
  38. ;
  39. ;    bx = 01h: Set operating mode
  40. ;    Entry:    ch = 00h disable 6845 emulation (default)
  41. ;           = 01h enable  6845 emulation
  42. ;
  43. ;    bx = 02h: VGA register protect
  44. ;    Entry:    ch = 00h to unprotect CRTC 00.07,10..17,MiscOutp (default)
  45. ;        ch = 01h to protect
  46. ;
  47. ;    bx = 03h: Enable/Disable fast mode
  48. ;    Entry:    ch = 00h to disable fast
  49. ;        ch = 01h to enable fast (default)
  50. ;
  51. ;    bx = 04h: Get paging function pointer for current mode
  52. ;    Exit:
  53. ;        - ES:DI -> paging function
  54. ;            DL = page to set on entry to any paging function
  55. ;            word preceding [ES:DI] is length of function
  56. ;            last byte of function is RETF
  57. ;            (Code can be FAR CALLed, or copied to application
  58. ;            buffer space and patched to a NEAR CALL.)
  59. ;
  60. ;    bx = 05h: Get mode supported info for current
  61. ;    Entry:    cl = Maximum number of modes to get info for
  62. ;        dl = monitor type to get mode info for
  63. ;        es:di -> buffer of sufficient size
  64. ;        ch = Mode type to get info for:
  65. ;           = 00h to get all modes
  66. ;           = 01h to get mono text modes
  67. ;           = 02h to get color text modes
  68. ;           = 03h to get 4 color (CGA) grfx modes
  69. ;           = 04h to get 1 color (CGA) grfx modes
  70. ;           = 05h to get 16 (planar) color grfx modes
  71. ;           = 06h to get 256 color grfx modes
  72. ;    Exit:
  73. ;        - cl = Total number of modes fitting criteria
  74. ;        - ch = Size of each record
  75. ;        Info record format:
  76. ;            (b) - Mode number (b7 set if it is an extended mode)
  77. ;            (b) - Mode format (same definition as ch above)
  78. ;            (b) - Info bits
  79. ;                (b0) - paged mode
  80. ;                (b1,2) Requires 256K/512K/1024K/2048K
  81. ;                (b3) - Requires special oscillator (44.9MHz for Ev678)
  82. ;                (b4) - Interlaced mode
  83. ;                (b5) - monochrome mode
  84. ;                (b6.7) - reserved
  85. ;            (b) - font height
  86. ;            (b) - Columns on screen (text format)
  87. ;            (b) - Rows on screen (text format)
  88. ;            (w) - Number of scan lines
  89. ;            (b) - Color info
  90. ;                (b0.3) Bits per pixel
  91. ;                (b4.7) reserved (0)
  92. ;        
  93. ;    bx = 06h: Program mode parameters
  94. ;    Entry:    ES:DI -> Standard 64-byte mode table
  95. ;        DS:DX -> Extra register table
  96. ;
  97. ;    bx = 09h:Everex Backdoor Set Mode (for dealing with obnoxious mice)
  98. ;    Entry:    ch = Setmode al
  99. ;        cl = Setmode bl
  100. ;------------------------------------------------------------------------
  101.  
  102. -------------------------------------------------------------------------
  103. -------------------------------------------------------------------------
  104.  
  105. ;------------------------------------------------------------------------
  106. ;Example program which sets Everex Extended Mode 15h, 512x480 256 color
  107. ;and draws a box around the perimeter of the screen.  This code uses
  108. ;Everex Extended BIOS function 0004h to get the paging function pointer
  109. ;for the particular card installed.  This code works on the Everex EVGA
  110. ;(Ev673), Everex Viewpoint VGA (Ev678), and the Everex Ultragraphics II
  111. ;VGA (Ev236), as well as all future Everex VGA cards, since it uses the
  112. ;device independent paging function pointer to perform memory paging.
  113. ;------------------------------------------------------------------------
  114. ;The paging function is used to change which 64K bank of memory is mapped
  115. ;into the CPU address space at segment A000.  The banks start at 0 at the
  116. ;top of the screen, and increment towards the bottom of the screen.  Each
  117. ;bank is 64K in size and is read/writeable.  This paging function code can
  118. ;be applied to high-resolution 16-color modes as well.
  119. ;------------------------------------------------------------------------
  120.  
  121. CR    equ    0Dh
  122. LF    equ    0Ah
  123.  
  124. rSequAddr    equ    3C4h
  125. rRMiscOutp    equ    3CCh
  126. rWMiscOutp    equ    3C2h
  127.  
  128. ;------------------------------------------------------------------------
  129.  
  130.     cseg    segment word public 'CODE'
  131.  
  132.     assume    cs:cseg
  133.     assume    ds:cseg
  134.     assume    es:cseg
  135.  
  136. ;------------------------------------------------------------------------
  137.  
  138.     org    0100h
  139.  
  140. Start:
  141.     mov    bx,0000h    ;Everex Extended BIOS Get Status
  142.     mov    ax,7000h
  143.     int    10h        ;Find out if Everex card is present
  144.                 ;and what kind it is.
  145.  
  146.     cmp    al,70h        ;Abort if not Everex VGA card
  147.     je    EverexCardDetected
  148.     jmp    EverexCardNotPresent
  149.  
  150. EverexCardDetected:
  151.     mov    ax,0070h
  152.     mov    bl,15h        ;Set Everex Extended 512x480 256-color
  153.     int    10h        ;mode.  Assume that setmode succeeds.
  154.  
  155.     and    dx,0FFF0h    ;Check card type from Get Status call
  156.     cmp    dx,6730h    ;Is it an EVGA?
  157.     je    SkipGetPaging
  158.  
  159.                 ;Note that paging function is called
  160.                 ;AFTER the setmode above.
  161.     mov    bx,0004h    ;Everex Extended Get Paging Function
  162.     mov    ax,7000h
  163.     int    10h
  164.  
  165.     cmp    al,70h
  166.     je    CopyPagingFunction
  167.     jmp    CantGetPageFunc    ;Abort if paging function not supported
  168.  
  169. CopyPagingFunction:
  170.     mov    si,es
  171.     mov    ds,si
  172.     mov    si,di        ;DS:SI -> Paging function in ROM
  173.  
  174.     mov    di,cs
  175.     mov    es,di
  176.     mov    di,offset ProgPage    ;Point to our internal function
  177.  
  178.     mov    cx,ds:[si-02h]    ;Get size of function in bytes
  179.  
  180.     rep    movsb        ;Copy function to our memory
  181.  
  182.     mov    al,cs:[ExampleRET]
  183.     mov    es:[di-01h],al    ;Patch RETF to RET
  184.  
  185. SkipGetPaging:            ;Re-entry here for EVGA
  186.                 ;We're now in 512x480 256-color mode
  187.                 ;and ProgPage contains a paging function
  188.                 ;for the current Everex VGA card, so
  189.                 ;let's draw the box.
  190.  
  191.     mov    di,0A000h
  192.     mov    es,di        ;ES = segment of graphics memory
  193.  
  194.  
  195.     mov    dl,00h        ;Note that 512x480 has a neat performance
  196.     call    SetPage        ;advantage in that 512 is a power of 2,
  197.                 ;and thus divides into 65536 (64K) evenly.
  198.                 ;In other words, one 64K bank contains
  199.                 ;exactly 128 scan lines, whereas a 640
  200.                 ;wide mode has a fractional scan line.
  201.  
  202.     mov    di,0000h    ;Point to first scan line
  203.     mov    cx,512d/2    ;Fill 512/2 = 256 words
  204.     mov    ax,0707h    ;Fill with white pixels
  205.     rep    stosw        ;Draw top horizontal line
  206.  
  207.  
  208.     mov    ax,479d        ;This is an easy example of how to calculate
  209.     mov    dx,512d        ;The page and offset of a scanline or pixel
  210.     mul    dx        ;479 is the scan line we want, and each scan
  211.                 ;line is 512 bytes wide.
  212.     add    ax,0000h    ;Add in the starting X pixel.  (This isn't
  213.     adc    dl,00h        ;much here, since X is 0, but it's given as
  214.                 ;and example.)
  215.     call    SetPage        ;Now AX = offset within the bank, and DL
  216.                 ;contains the bank number we need to map
  217.                 ;into our window.
  218.     mov    di,ax        ;Point to last scan line
  219.     mov    cx,512d/2    ;Fill 512/2 = 256 words
  220.     mov    ax,0707h    ;Fill with white pixels
  221.     rep    stosw        ;Draw bottom horizontal line
  222.  
  223.  
  224.     mov    dl,00h
  225.     call    SetPage        ;Map in top bank
  226.  
  227.     mov    di,0000h    ;Point to upper left corner of screen
  228.     mov    bx,512d        ;Offset from one pixel to the one below it.
  229.     mov    cx,480d        ;Number of pixels to do vertically
  230.     mov    al,07h        ;Draw white pixels
  231.  
  232. DrawLeftSideLoop:
  233.     mov    es:[di],al    ;Draw one pixel
  234.     add    di,bx        ;Move down to next
  235.     jnc    DrawLeftSideCont    ;Did we move past the end of a segment
  236.  
  237.     inc    dl        ;Yes, so move to next page
  238.     call    SetPage    
  239.  
  240. DrawLeftSideCont:
  241.     loop    DrawLeftSideLoop    ;and loop
  242.  
  243.  
  244.     mov    dl,00h
  245.     call    SetPage        ;Map in top bank
  246.  
  247.     mov    di,511d        ;Point to upper right corner of screen
  248.     mov    bx,512d        ;Offset from one pixel to the one below it.
  249.     mov    cx,480d        ;Number of pixels to do vertically
  250.     mov    al,07h        ;Draw white pixels
  251.  
  252. DrawRightSideLoop:
  253.     mov    es:[di],al    ;Draw one pixel
  254.     add    di,bx        ;Move down to next
  255.     jnc    DrawRightSideCont    ;Did we move past the end of a segment
  256.  
  257.     inc    dl        ;Yes, so move to next page
  258.     call    SetPage    
  259.  
  260. DrawRightSideCont:
  261.     loop    DrawRightSideLoop    ;and loop
  262.  
  263.  
  264.     mov    dl,00h        ;Map bank back to top bank
  265.     call    SetPage
  266.  
  267.     mov    dx,cs
  268.     mov    ds,dx
  269.     mov    dx,offset ProgramDoneMesg
  270.     mov    ah,09h
  271.     int    21h
  272.  
  273.     mov    ax,4C00h    ;Return code OK
  274.     int    21h        ;Program done
  275.  
  276. ;------------------------------------------------------------------------
  277.  
  278. EverexCardNotPresent:    ;Abort if not Everex VGA card
  279.     mov    dx,offset NotEverexCardMesg
  280.     jmp    short OutputErrorMesg
  281.  
  282. CantGetPageFunc:    ;Abort if paging function not supported
  283.     mov    dx,offset CantGetPageMesg
  284. OutputErrorMesg:
  285.     mov    ax,cs
  286.     mov    ds,ax
  287.     mov    ah,09h
  288.     int    21h
  289.  
  290.     mov    ax,4C01h    ;Exit with error return code
  291.     int    21h
  292.  
  293. ;------------------------------------------------------------------------
  294.  
  295. ActivePage    db 00h        ;Global variable holding current bank number
  296.  
  297. ProgramDoneMesg    label    byte
  298.     db 'Program successful.',CR,LF,'$'
  299.  
  300. NotEverexCardMesg    label    byte
  301.     db 'ERROR: Everex VGA card not detected.',CR,LF,'$'
  302.  
  303. CantGetPageMesg        label    byte
  304.     db 'ERROR: Can not obtain Everex paging function.',CR,LF,'$'
  305.  
  306. ;------------------------------------------------------------------------
  307. ;Memory paging function for Everex EVGA (Ev673) for Everex Extended
  308. ;256-color modes.  Note that this code only works on the EVGA.  For
  309. ;other Everex VGA cards, this code will be overwritten with the
  310. ;paging function code for the particular Everex VGA card installed.
  311. ;------------------------------------------------------------------------
  312. ;Entry:    DL = page number to select
  313.  
  314. SetPage        proc    near
  315.     
  316.     mov    cs:[ActivePage],dl    ;Keep a copy around for other
  317.                     ;functions to look at, like mouse
  318.                     ;handlers.
  319. ProgPage    proc    near
  320.  
  321.     push    dx
  322.     push    bx
  323.     push    ax
  324.  
  325.     mov    bl,dl
  326.     mov    bh,dl
  327.  
  328.     mov    dx,rSequAddr        ; Set page bit in Sequencer
  329.     mov    al,8            ; This selects between 0,2 and 1,3
  330.     mov    ah,al            ; Save for later reference
  331.     out    dx,al
  332.     inc    dx
  333.     jmp    short $+2
  334.     in    al,dx            ; Get old value
  335.  
  336.     ror    bl,1
  337.     and    bl,80h
  338.     and    al,7fh
  339.     or    al,bl
  340.  
  341.     xchg    ah,al            ; AL = EvrxCtrl1, AH = new bits
  342.     dec    dx
  343.     out    dx,ax
  344.     jmp    short $+2
  345.  
  346.     and    bh,2
  347.     shl    bh,1
  348.     shl    bh,1
  349.     shl    bh,1
  350.     shl    bh,1
  351.     
  352.     xor    bh,20h            ; Invert bit
  353.     mov    dx,rRMiscOutp        ; Now read other register
  354.     in    al,dx
  355.     mov    dx,rWMiscOutp
  356.  
  357.     and    al,0DFh
  358.     or    al,bh
  359.     out    dx,al
  360.  
  361.     pop    ax
  362.     pop    bx
  363.     pop    dx
  364.     ret
  365.  
  366.     db    (100 - ($ - offset ProgPage)) dup (00h)
  367.                     ;Pad buffer out to 256 bytes
  368.                     ;for copying paging code in here.
  369.  
  370. ExampleRet    label    byte    ;Used to patch the RETF in the paging
  371.     ret            ;code to a RET for near calls to
  372.                 ;ProgPage
  373. ProgPage    endp
  374.  
  375. SetPage        endp
  376.  
  377. ;------------------------------------------------------------------------
  378.  
  379. cseg    ends
  380.  
  381.     end    Start
  382.  
  383. ;------------------------------------------------------------------------
  384.  
  385. -------------------------------------------------------------------------
  386. -------------------------------------------------------------------------
  387.  
  388.  
  389.  
  390. {-----------------------------------------------------------------------}
  391. { Program to get from the BIOS and any EV-678 mode TSR present a list   }
  392. { of all of the modes supported for a particular monitor.  It also    }
  393. { reads the state of the board.  It does this by calling the two     }
  394. { Everex Extended BIOS functions below:                    }
  395. {-----------------------------------------------------------------------}
  396. {    bx = 00h: return emulation status                }
  397. {        - cl = monitor type                    }
  398. {        - ch (b0)   = 6845 emulation                }
  399. {        -    (b1,3) = unused (0)                }
  400. {        -    (b4)   = VGA Protect enabled            }
  401. {        -    (b5)   = 44.9MHz present                }
  402. {        -    (b6,7) = 256K/512K/1024K/2048K            }
  403. {        - dx = BCD board id (b15..b4: model, b3..b0: revision)    }
  404. {        - di = BCD BIOS version number                }
  405. {-----------------------------------------------------------------------}
  406. {    bx = 05h: Get mode supported info for current            }
  407. {    Entry:    cl = Maximum number of modes to get info for        }
  408. {        dl = monitor type to get mode info for            }
  409. {        es:di -> buffer of sufficient size            }
  410. {        ch = Mode type to get info for:                }
  411. {           = 00h to get all modes                }
  412. {           = 01h to get mono text modes                }
  413. {           = 02h to get color text modes            }
  414. {           = 03h to get 4 color (CGA) grfx modes        }
  415. {           = 04h to get 1 color (CGA) grfx modes        }
  416. {           = 05h to get 16 color grfx modes            }
  417. {           = 06h to get 256 color grfx modes            }
  418. {        - cl = Total number of modes fitting criteria        }
  419. {        - ch = Size of each record                }
  420. {        Info record format:                    }
  421. {            (b) - Mode number (b7 set if it is an extended mode)}
  422. {            (b) - Mode format (same definition as ch above)    }
  423. {            (b) - Info bits                    }
  424. {                (b0) - paged mode            }
  425. {                (b1,2) Requires 256K/512K/1024K/2048K    }
  426. {                (b3) - Requires 44.9MHz            }
  427. {                (b4) - Interlaced mode            }
  428. {                (b5) - monochrome mode            }
  429. {                (b6.7) - reserved            }
  430. {            (b) - font height                }
  431. {            (b) - Columns on screen (text format)        }
  432. {            (b) - Rows on screen (text format)        }
  433. {            (w) - Number of scan lines            }
  434. {            (b) - Color info                }
  435. {                (b0.3) Bits per pixel            }
  436. {                (b4.7) reserved (0)            }
  437. {    bx = 05h: Get mode supported info for current            }
  438. {    Entry:    cl = Maximum number of modes to get info for        }
  439. {        dl = monitor type to get mode info for            }
  440. {        es:di -> buffer of sufficient size            }
  441. {        ch = Mode type to get info for:                }
  442. {           = 00h to get all modes                }
  443. {           = 01h to get mono text modes                }
  444. {           = 02h to get color text modes            }
  445. {           = 03h to get 4 color (CGA) grfx modes        }
  446. {           = 04h to get 16 color grfx modes            }
  447. {           = 05h to get 256 color grfx modes            }
  448. {        - cl = Total number of modes fitting criteria        }
  449. {        - ch = Size of each record                }
  450. {        Info record format:                    }
  451. {            (b) - Mode number (b7 set if it is an extended mode)}
  452. {            (b) - Mode format (same definition as ch above)    }
  453. {            (b) - Info bits                    }
  454. {                (b0) - paged mode            }
  455. {                (b1,2) Requires 256K/512K/1024K/2048K    }
  456. {                (b3) - Requires 44.9MHz            }
  457. {                (b4) - Interlaced mode            }
  458. {                (b5) - monochrome mode            }
  459. {                (b6.7) - reserved            }
  460. {            (b) - font height                }
  461. {            (b) - Columns on screen (text format)        }
  462. {            (b) - Rows on screen (text format)        }
  463. {            (w) - Number of scan lines            }
  464. {            (b) - Color info                }
  465. {                (b0.3) - Bits per color            }
  466. {                (b4.7) - reserved (0)            }
  467. {-----------------------------------------------------------------------}
  468.  
  469. uses
  470.     dos;
  471.  
  472. {-----------------------------------------------------------------------}
  473.  
  474. type
  475.     s64 = string[64];
  476.  
  477.     Ev678ModeInfoType = record
  478.         mode    : byte;
  479.     memorg    : byte;
  480.     info    : byte;
  481.     points  : byte;
  482.     columns : byte;
  483.     rows    : byte;
  484.     scanline: word;
  485.     color    : byte;
  486.     end;
  487.  
  488. {-----------------------------------------------------------------------}
  489.  
  490. const
  491.     MonitorType : array [$00..$07] of s64 = 
  492.        ('Monochrome',
  493.         'CGA',
  494.     'EGA',
  495.     'TTL multifrequency',
  496.     'IBM PS/2 fixed frequency',
  497.     'IBM 8514 fixed frequency',
  498.     'Analog multifrequency',
  499.     'Analog multifrequency');
  500.  
  501.     EmulationType : array [$00..$01] of s64 = 
  502.        ('Standard VGA',
  503.         '6845 emulation');
  504.  
  505.     MemorySizeType : array [$00..$03] of s64 = 
  506.        (' 256K',
  507.         ' 512K',
  508.     '1024K',
  509.     '2048K');
  510.  
  511.     ProtectType : array [$00..$01] of s64 = 
  512.        ('VGA registers unprotected',
  513.         'VGA registers protected');
  514.  
  515.     CrystalPresentType : array [$00..$01] of s64 = 
  516.        ('44.9MHz crystal not present',
  517.         '44.9MHz crystal present');
  518.  
  519.     MemoryOrgType : array [$00..$08] of s64 = 
  520.        ('Invalid  ',
  521.         'Mono Txt ',
  522.         'Colr Txt ',
  523.         '4 Grfx   ',
  524.         '2 Grfx   ',
  525.         'Planar   ',
  526.         '256 Grfx ',
  527.     'Unknown  ',
  528.     'Unknown  ');
  529.  
  530.     CrystalNeededType : array [$00..$01] of s64 = 
  531.        ('       ',
  532.         '44.9MHz');
  533.  
  534.     InterlacedType : array [$00..$01] of s64 = 
  535.        ('       ',
  536.         'intrlcd');
  537.  
  538.     PagedType : array [$00..$01] of s64 = 
  539.        ('     ',
  540.         'paged');
  541.  
  542.     ColorMonoType : array [$00..$01] of s64 = 
  543.        ('C',
  544.         'M');
  545.  
  546. {-----------------------------------------------------------------------}
  547.  
  548. var
  549.     reg     : Registers;
  550.     i       : byte;
  551.  
  552.     modeptr : ^Ev678ModeInfoType;
  553.     indxptr : ^Ev678ModeInfoType;
  554.     modesize: byte;
  555.     modenum : byte;
  556.     modeind : byte;
  557.  
  558. {-----------------------------------------------------------------------}
  559. {-----------------------------------------------------------------------}
  560.  
  561. function decval(decnum : real) : s64;
  562.  
  563. const table : array [0..15] of char = ('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
  564.  
  565. begin
  566.     decval := table[trunc(decnum)];
  567. end;
  568.  
  569. function dectohex(decnum : real) : s64;
  570.  
  571. begin
  572.     if decnum >= 16.0 then begin
  573.         dectohex := dectohex(decnum/16) + decval(decnum - 16.0*trunc(decnum/16.0));
  574.     end else
  575.         dectohex := decval(decnum);
  576. end;
  577.  
  578. function hex(decnum : real) : s64;
  579.  
  580. var i : byte;
  581.     tmp : s64;
  582.  
  583. begin
  584.     tmp := dectohex(decnum);
  585.     for i := 1 to 2-Length(tmp) do
  586.         tmp := '0'+tmp;
  587.     tmp := tmp+'h';
  588.     hex := tmp;
  589. end;
  590.  
  591. {-----------------------------------------------------------------------}
  592. {-----------------------------------------------------------------------}
  593.  
  594. begin
  595.     reg.AX := $7000;
  596.     reg.BX := $0000;        { Get card info }
  597.     Intr($10,reg);
  598.  
  599.     if (reg.AL<>$70) then begin
  600.         writeln('Everex Extended BIOS calls not supported.');
  601.     halt(1);
  602.     end;
  603.     if ((reg.DX and $FFF0)=$6730) then begin
  604.         writeln('Everex EVGA (EV673) does not support mode info function.');
  605.     halt(1);
  606.     end;
  607.  
  608.     write('Adapter     : EV-');
  609.     for i := 0 to 2 do begin
  610.         write(chr(((reg.DX shr $0C) and $0F) + ord ('0')));
  611.         reg.DX := reg.DX shl $04;
  612.     end;
  613.     writeln;
  614.  
  615.     write('BIOS Version: v');
  616.     for i := 0 to 2 do begin
  617.         reg.DI := reg.DI shl $04;
  618.         write(chr(((reg.DI shr $0C) and $0F) + ord ('0')));
  619.     if (i=0) then
  620.         write('.');
  621.     end;
  622.     writeln;
  623.  
  624.     writeln('Monitor Type: ',MonitorType[reg.cl]);
  625.     writeln('Emulation   : ',EmulationType[reg.ch and $01]);
  626.     writeln('Memory Size : ',MemorySizeType[(reg.ch shr 6) and $03]);
  627.     writeln('Protection  : ',ProtectType[(reg.ch shr 4) and $01]);
  628.     writeln('44.9MHz     : ',CrystalPresentType[(reg.ch shr 5) and $01]);
  629.  
  630.     reg.AX := $7000;
  631.     reg.BX := $0005;        { Get mode info }
  632.     reg.DL := reg.CL;        { Get mode info for current monitor }
  633.     reg.CL := $00;        { Get 00 modes on the first call }
  634.     reg.CH := $00;        { Get all modes }
  635.     Intr($10,reg);
  636.  
  637.     modenum := reg.CL;        { Get total number of modes }
  638.     modesize:= reg.CH;        { Get size of each record }
  639.  
  640.     GetMem(modeptr,modenum*modesize);
  641.  
  642.     reg.AX := $7000;
  643.     reg.CH := $00;        { Get all modes }
  644.     reg.ES := Seg(modeptr^);
  645.     reg.DI := Ofs(modePtr^);
  646.     Intr($10,reg);        { Get all mode info }
  647.  
  648.     for modeind := 0 to modenum-1 do begin
  649.     
  650.         indxptr := Ptr(Seg(modeptr^),Ofs(modeptr^)+modeind*modesize);
  651.  
  652.     with indxptr^ do begin
  653.         if(mode>=$80) then
  654.             write('x')
  655.         else
  656.             write(' ');
  657.         write(hex(mode and $7F),' ');
  658.         
  659.         write(MemoryOrgType[memorg],' ');
  660.         
  661.         write(columns:3,'x');
  662.         
  663.         write(rows:2,' ');
  664.         
  665.         if ((points and $80) = $80) then
  666.             write('9')
  667.         else
  668.             write('8');
  669.         write('x',(points and $3F):2,' ');
  670.         
  671.         if ((points and $80) = $80) then
  672.             write(9*columns:4)
  673.         else
  674.             write(8*columns:4);
  675.         write('x',scanline:3);
  676.         write('x',(color and $0F):1,' ');
  677.         
  678.         write(ColorMonoType[(info shr 5) and $01],' ');
  679.         write(MemorySizeType[(info shr 1) and $03],' ');
  680.         write(CrystalNeededType[(info shr 3) and $01],' ');
  681.         write(PagedType[info and $01],' ');
  682.         write(InterlacedType[(info shr 4) and $01],' ');
  683.  
  684.     end; {with}
  685.         
  686.     writeln;
  687.  
  688.     end; {for}
  689.  
  690. end.
  691.  
  692. {-----------------------------------------------------------------------}
  693. {-----------------------------------------------------------------------}
  694. {-----------------------------------------------------------------------}
  695. {-----------------------------------------------------------------------}
  696.  
  697.  
  698. {-----------------------------------------------------------------------}
  699. { The following code is an example of how to recognize older Everex    }
  700. { EGA/VGA cards, so that software can be written to be backwards    }
  701. { compatible across all cards, if necessary.                }
  702. {-----------------------------------------------------------------------}
  703. { The following sample code can be used to recognize the type of Everex    }
  704. { EGA/VGA card installed, and thus allow an application program to    }
  705. { figure out which Everex extended resolution modes are available.    }
  706. {-----------------------------------------------------------------------}
  707. { For more information, call the Everex BBS at (415) 683-2984.        }
  708. {-----------------------------------------------------------------------}
  709. { NOTE: This code does not make a determination of the physical monitor    }
  710. { type.  It is not possible to determine the physical monitor        }
  711. { type (the monitor actually attached to the adapter) for an EV-657 or    }
  712. { EV-659.  It is possible to determine the physical monitor for the     }
  713. { EV-673 by saving the value in register CL following the INT 10h call    }
  714. { below (**).  This could be of use to disallow the user from selecting    }
  715. { an Everex Extended mode which    could damage the monitor.        }
  716. {-----------------------------------------------------------------------}
  717. { The following abbreviations are used below:                }
  718. {                                    }
  719. {    MON   - TTL monochrome monitor                    }
  720. {    CGA   - CGA compatible monitor                    }
  721. {    EGA   - EGA compatible monitor                    }
  722. {    DMF   - Digital (TTL) multi-frequency monitor            }
  723. {    DMF#1 - Digital (TTL) multi-frequency monitor (e.g. NEC)    }
  724. {    DMF#2 - Digital (TTL) multi-frequency monitor (e.g. Sony)    }
  725. {    PS2   - IBM PS/2 fixed frequency monitor            }
  726. {    AMF   - Analog multi-frequency monitor                }
  727. {    AMF#1 - Analog multi-frequency monitor (e.g. NEC)        }
  728. {    AMF#2 - Analog multi-frequency monitor (e.g. Sony)        }
  729. {                                    }
  730. { Note that the DMF#1, DMF#2, AMF#1, and AMF#2 abbreviations are only    }
  731. { used to distinguish monitor types better for the EV-673.  The DMF    }
  732. { (AMF) abbreviation is used whenever both DMF#1 and DMF#2 (AMF#1 and    }
  733. { AMF#2) are supported in that resolution.                 }
  734. {-----------------------------------------------------------------------}
  735. { Everex Extended modes can be set by calling INT 10h with the following}
  736. { parameters:                                }
  737. {                                    }
  738. {    AH = 00h    ; IBM standard set mode call            }
  739. {    AL = 70h    ; Special flag signifying Everex Extended    }
  740. {    BL = mode#    ; Mode number listed below            }
  741. {                                    }
  742. { Note that all modes are resident in the ROM, so there are no external    }
  743. { tables or extra programming to handle.  Bit #7 of AL still works as    }
  744. { a save regen buffer flag.  Also, the mode number placed in 0:449h in    }
  745. { the BIOS data area will be the mode number of a compatible IBM     }
  746. { standard mode (03h for color text, 07h for mono text, 10h for 16    }
  747. { color, 13h for 256 color.)                        }
  748. {-----------------------------------------------------------------------}
  749. { The following modes are supported by all 8 cards (EV657_1, EV657_2,    }
  750. { EV657_3, EV657_B, EV659, EV659_2600, EV659_2, EV673):            }
  751. {                                    }
  752. {Evrx Extd    Type        Resolution    Font    Monitors    }
  753. {=========    ====        ==========    ====    ========    }
  754. {   00h        16 color grfx    640x480        8x14    AMF,DMF,PS2    }
  755. {   01h        16 color grfx    752x410        8x14    AMF,DMF        }
  756. {   03h        color text    80x34        8x14    AMF,DMF,PS2    }
  757. {   04h        color text    80x60        8x8    AMF,DMF,PS2    }
  758. {   05h        color text    94x29        8x14    AMF,DMF        }
  759. {   06h        color text    94x51        8x8    AMF,DMF        }
  760. {   09h        color text    80x44        8x8    AMF,DMF,PS2,EGA    }
  761. {   0Ah        color text    132x25        ?x14    AMF,DMF,PS2,EGA    }
  762. {   0Bh        color text    132x44        ?x8    AMF,DMF,PS2,EGA    }
  763. {   0Ch        color text    132x25        ?x8    AMF,DMF,PS2,EGA,CGA}
  764. {   0Dh        mono text    80x44        8x8    AMF,DMF,PS2,MON    }
  765. {   0Eh        mono text    132x25        ?x14    AMF,DMF,PS2,MON    }
  766. {   0Fh        mono text    132x44        ?x8    AMF,DMF,PS2,MON    }
  767. {   10h        mono text    132x25        ?x8    AMF,DMF,PS2    }
  768. { The ? in the font column denotes that the font width may be 5, 6 or    }
  769. { 8 dots.  This is not of importance unless a user program loads up    }
  770. { alternate fonts.                            }
  771. {-----------------------------------------------------------------------}
  772. { The following modes are supported by the EV657_3, EV659_2600, EV659_2,}
  773. { and EV673:                                }
  774. {                                    }
  775. {Evrx Extd    Type        Resolution    Font    Monitors    }
  776. {=========    ====        ==========    ====    ========    }
  777. {   02h        16 color grfx    800x600        8x14    AMF,DMF        }
  778. {   07h        color text    100x43        8x14    AMF,DMF        }
  779. {   08h        color text    100x75        8x8    AMF,DMF        }
  780. {-----------------------------------------------------------------------}
  781. { The following modes are supported by the EV659_2600 and EV673:    }
  782. {                                    }
  783. {Evrx Extd    Type        Resolution    Font    Monitors    }
  784. {=========    ====        ==========    ====    ========    }
  785. {   11h        4 color grfx    1280x350(1)    8x14    DMF,EGA        }
  786. {   12h        4 color grfx    1280x600(1)    8x14    DMF        }
  787. {   16h        color text    80x30        8x16    AMF,DMF,PS2    }
  788. {   17h        color text    94x25        8x16    AMF,DMF        }
  789. {   18h        color text    100x37        8x16    AMF,DMF        }
  790. {-----------------------------------------------------------------------}
  791. { The following modes are supported by the EV673:            }
  792. {                                    }
  793. {Evrx Extd    Type        Resolution    Font    Monitors    }
  794. {=========    ====        ==========    ====    ========    }
  795. {   13h        256 color grfx    640x350(1,2)    8x14    AMF#2,DMF#2,EGA    }
  796. {   14h        256 color grfx    640x400(1,2)    8x14    AMF#2,DMF#2    }
  797. {   15h        256 color grfx    512x480(1,2)    8x14    AMF,DMF        }
  798. { (1) These modes have special memory organizations that require special}
  799. {     programming.                            }
  800. { (2) When attached to a digital (TTL) monitor, these modes will only    }
  801. {     yield 64 colors from a fixed palette.                }
  802. {-----------------------------------------------------------------------}
  803. { When writing programs for the 1280x600 mode, it is important to     }
  804. { remember that the Miscellaneous Output register (3C2h) value is     }
  805. { different for the EV673 and the EV659_2600.  This value is used to     }
  806. { select between page 0 and page 1 of the graphics screen memory.  These}
  807. { values are given below:                        }
  808. {        EV673    EV659_2600                    }
  809. {        =====    ==========                    }
  810. { Page 0    0B7h       0BBh                        }
  811. { Page 1    097h       09Bh                        }
  812. {-----------------------------------------------------------------------}
  813. { When writing programs for the hi-res 256 color modes on the EV673,    }
  814. { software must manipulate the paging bits in 3C2/b5 and 3C4/8/b7.    }
  815. { The read address of 3C2 is 3CC.  These registers should be read    }
  816. { back, modified, and written back so as not to modify other bits.    }
  817. {        3C2/b5    3C4/8/b7                    }
  818. {        ======    ========                    }
  819. { Page 0      1       0                        }
  820. { Page 1      1       1                        }
  821. { Page 2      0       0                        }
  822. { Page 3      0       1                        }
  823. {-----------------------------------------------------------------------}
  824. { This signature checking code scans through the first 4K of the ROM    }
  825. { BIOS area at C000 looking for the string 'EVEREX SYSTEM INC.'.  If    }
  826. { this string is found, it looks at the 2 bytes immediately following    }
  827. { the '.' -- these two bytes give the board number and revision number    }
  828. { as shown below in the case statement table.  By examining the value    }
  829. { of 'board' and using the tables above, you can make a determination    }
  830. { of the capabilities of EGA or VGA adapter.                }
  831. {-----------------------------------------------------------------------}
  832.  
  833. type
  834.     BoardType = ( UNKNOWN, EV657_1, EV657_2, EV657_3, EV657_B, EV659,
  835.                   EV659_2600, EV659_2, EV673 );
  836.     string255 = string[255];
  837.     word      = integer;
  838.     registers = record
  839.             case integer of
  840.             0 : ( ax,bx,cx,dx,bp,si,di,ds,es,flags : word );
  841.             1 : ( al,ah,bl,bh,cl,ch,dl,dh : byte );
  842.             end;
  843.  
  844. procedure WhichBoard;
  845.  
  846. const
  847.     EVSIGHDR = $5645;
  848.     EVSIG    = 'EVEREX SYSTEM INC.';
  849. var
  850.        regs : registers;
  851.         buf : string255;
  852.       found : boolean;
  853.    boardRev : word;
  854.          ch : char;
  855.       board : BoardType;
  856.     monitor : word;
  857.           i : integer;
  858.  
  859. begin
  860.     with regs do begin
  861.         ah := $70;            { EV673 Extended BIOS call }
  862.         bx := 0;
  863.     end;  { with }
  864.     intr ( $10, regs );
  865.     if regs.al = $70 then begin
  866.         board := EV673;
  867. {**    monitor := regs.CL}        { Get physical monitor type    }   
  868.                     { CL = 00h => TTL monochrome    }
  869.                     {    = 01h => CGA        }
  870.                     {    = 02h => EGA        }
  871.                     {    = 03h => TTL multi-freq #1    }
  872.                     {    = 04h => TTL multi-freq #2    }
  873.                     {    = 05h => Anlg multi #1    }
  874.     exit;                {    = 06h => IBM PS/2 fixed    }
  875.     end;  { if }            {    = 07h => Anlg multi #2    }
  876.  
  877.     i := 0;
  878.     found := FALSE;
  879.     board := UNKNOWN;
  880.     while (i < $1000) and not(found) do begin
  881.         if mem[$c000:i] = ord('E') then begin
  882.             move ( mem[$c000:i], buf[1], length(EVSIG)+1 );
  883.             buf[0] := chr(length(EVSIG));
  884.             if buf = EVSIG then begin
  885.                 found := TRUE;
  886.                 boardRev := memw[$c000:i+length(EVSIG)];
  887.                 case boardRev of
  888.                     $5701 : board := EV657_1;
  889.                     $5702 : board := EV657_2;
  890.                     $5703 : board := EV657_3;
  891.                     $572B : board := EV657_3;
  892.                     $570B : board := EV657_B;
  893.                     $5901 : board := EV659;
  894.                     $5909 : board := EV659;
  895.                     $5902 : board := EV659_2;
  896.             $5926 : board := EV659_2600;
  897.                     else begin
  898.             if ( hi (boardRev)=$57 ) then board := EV657_3 
  899.             else if ( hi (boardRev)=$59 ) then board := EV659_2
  900.                         else board := UNKNOWN
  901.             end;
  902.                 end;  { case }
  903.             end;  { if }
  904.         end;  { if }
  905.         i := i + 1;
  906.     end;  { for }
  907. end;  { WhichBoard }
  908.  
  909. {-----------------------------------------------------------------------}
  910.